<?php
// 1删除一个数组中重复的值
/*
$arr_diff = array(1,112,31,1,2,3,11,2,1,2,56,4);

     $arr2=array_flip(array_flip($arr_diff));

     print_r($arr2);
 
 //   print_r(array_unique($arr_diff));
*/

//2、交换数组中的键名和值

//把  array(24=>'age',male=>'sex','no'=>'yes')

//转换成  array('age'=>24,'sex'=>'male','yes'=>'no')

/*    $arr1=array(24=>'age',male=>'sex','no'=>'yes');

    $arr2=array('age'=>24,'sex'=>'male','yes'=>'no');


  
    $sex = 'male';
    $key = 'sex';
    
    $bbb=array();
    $bbb[$key]=$sex;

    print_r($bbb);
*/
 /*   $new=array();


    foreach ($arr1 as $key => $value) {
        $new[$value]=$key;	
    }

    print_r($new);

*/

 //   $arr1=array(24=>'age',male=>'sex','no'=>'yes');

    $arr2=array('age'=>24,'sex'=>'male','yes'=>'no');
/*
    $new=array();
    foreach($arr2 as $key=>$value){
    	$new[$value]=$key;
    }
    print_r($new);

*/
    /*
    $new=array();
    foreach($arr2 as $key=>$value){
    	$new[$value]=$key;
    }
    print_r($new);
*/
/*
   $new=array();
   foreach($arr2 as $key=>$value){
   	  $new[$value]=$key;
   }
   print_r($new);
*/

   $new=array();
   foreach($arr2 as $key=>$value){
   	   $new[$value]=$key;
   }
   print_r($new);